<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>计算表达式</title>
  </head>
  <body>
    <div class="" id="example">
      <p>a={{a}},b={{b}}</p>
      <p>
        {{fullName}}
      </p>
    </div>

    <script src="js/jquery-1.8.3.min.js" charset="utf-8"></script>
    <script src="js/vue.js" charset="utf-8"></script>
    <script type="text/javascript">
      var vm;
      $(function(){
        vm = new Vue({
          el:"#example",
          data:{
            a:1,
            firstName:'Jim',
            lastName:'mingjiang'
          },
          computed:{
            // 一个计算属性的 getter
            b: function(){
              // this 只指向 vm 实例
              return this.a+1
            },
            fullName:function(){
              return this.firstName+' '+this.lastName
            }
          }
        });
      })
    </script>
  </body>
</html>
